package org.jaaksi.customviewdemo

import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_test_ripple2.*
import org.jaaksi.customviewdemo.roundview.setRoundBg
import timber.log.Timber

class TestRippleActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_test_ripple2)

//        textView0.setRoundBg {
//            rippleEnable = true
////            cornerRadius = 17.dp
//            halfRoundCorner = true
//            backgroundColor = Color.RED
//        }

        tv3.setRoundBg {
            setGradient(
                intArrayOf(Color.WHITE, Color.RED),
                orientation = GradientDrawable.Orientation.TOP_BOTTOM
            )
        }

        tv2.setOnClickListener {
            val arr1 = arrayOf(1, 2, 3, 4, 5, 6, 7)
            val arr2 = arrayOf(0, 0, 0, 0, 0, 0, 0)
            System.arraycopy(arr1, 2, arr2, 0, 3)
            Timber.e("arr2 = ${arr2.joinToString()}")
//            Timber.e("${aFun2(Float.NaN)}")
//            Timber.e("${aFun2(2.5f)}")
//            Timber.e("${aFun2(2.70001f)}")
//            Timber.e("${aFun2(0f)}")
//            Timber.e("${aFun2(8f/0f)}")
            starView.invalidate()
        }

    }


    fun aFun2(f2: Float): Float {
        return java.lang.Float.intBitsToFloat(java.lang.Float.floatToRawIntBits(f2) and Int.MAX_VALUE)
    }

}